In [1]:
my_list = [1,2,3]
In [2]:
my_list
Out[2]:
In [3]:
my_list = ["shashank","Ragireddy",34,True]
In [4]:
my_list
Out[4]:
In [5]:
len(my_list)
Out[5]:
In [11]:
type(my_list[0])
Out[11]:
In [13]:
print(type(my_list[0]))
print(type(my_list[1]))
print(type(my_list[2]))
print(type(my_list[3]))
In [14]:
my_list[0:]
Out[14]:
In [15]:
my_list[::-1]
Out[15]:
In [16]:
my_list[:2]
Out[16]:
In [17]:
my_list[1:3]
Out[17]:
In [19]:
my_list + ["New Item"]
Out[19]:
In [20]:
my_list
Out[20]:
In [31]:
my_list = my_list + ["Permanet Item"]
In [22]:
my_list
Out[22]:
In [25]:
my_list *2
Out[25]:
In [28]:
my_list
Out[28]:
In [29]:
my_list.remove("Permanet Item")
In [30]:
my_list
Out[30]:
In [33]:
my_list.pop(4)
Out[33]:
In [34]:
my_list
Out[34]:
In [36]:
my_list.append("A")
In [37]:
my_list
Out[37]:
In [38]:
my_list.insert(0,"FIRST POSITION")
In [39]:
my_list
Out[39]:
In [43]:
my_list.count("shashank")
Out[43]:
In [49]:
my_lst = [2,5,1,4,0]
In [50]:
my_lst
Out[50]:
In [51]:
my_lst.sort()
In [52]:
my_lst
Out[52]:
In [53]:
my_lst.reverse()
In [54]:
my_lst
Out[54]:
In [56]:
l_1 = [1,2,3]
l_2 = [4,5,6]
l_3 = [7,8,9]
In [58]:
matrix = [l_1,l_2,l_3]
In [59]:
matrix
Out[59]:
In [61]:
martix[0][0]
Out[61]:
In [62]:
matrix[1][1]
Out[62]:
In [63]:
sec_col = [item[1] for item in matrix]
sec_col
Out[63]:
In [66]:
for item in matrix:
print(item[2])
In [ ]: